home *** CD-ROM | disk | FTP | other *** search
/ Programming an RTS Game with Direct3D / Programming an RTS Game with Direct3D.iso / Examples / Chapter 14 / Example 14.1 / building.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-06-30  |  1.3 KB  |  58 lines

  1. #ifndef _RTS_BUILDING_
  2. #define _RTS_BUILDING_
  3.  
  4. #include "mapObject.h"
  5. #include "mesh.h"
  6. #include "debug.h"
  7. #include "terrain.h"
  8.  
  9. class PLAYER;
  10.  
  11. void LoadBuildingResources(IDirect3DDevice9* m_pDevice);
  12. void UnloadBuildingResources();
  13. bool PlaceOk(int buildType, INTPOINT mp, TERRAIN *terrain);
  14.  
  15. #define TOWNHALL 0
  16. #define BARRACKS 1
  17. #define TOWER 2
  18.  
  19. class BUILDING : public MAPOBJECT
  20. {
  21.     friend class MAPOBJECT;
  22.     friend class PLAYER;
  23.     friend class TRAIN_UNIT;
  24.     public:
  25.         BUILDING(int _type, int _team, bool finished, INTPOINT mp, TERRAIN *_terrain, PLAYER *_player, bool _affectTerrain, IDirect3DDevice9* Dev);
  26.         ~BUILDING();
  27.  
  28.         void Render();
  29.         void RenderFires();
  30.  
  31.         void Update(float deltaTime);
  32.         BBOX GetBoundingBox();
  33.         D3DXMATRIX GetWorldMatrix();        
  34.         bool isDead();
  35.         void Damage(int dmg, MAPOBJECT* attacker);
  36.  
  37.         void TrainUnit(int unit);
  38.  
  39.     private:
  40.  
  41.         //Building m_fires
  42.         D3DXVECTOR3 m_firePos[3], m_fireScale[3];
  43.         std::vector<EFFECT_FIRE*> m_fires;        
  44.  
  45.         float m_deathCountDown, m_buildProgress, m_buildSpeed;
  46.         BBOX m_BBox;
  47.         MESHINSTANCE m_meshInstance;
  48.         bool m_affectTerrain;
  49.         PLAYER *m_pPlayer;
  50.  
  51.         //Unit Training variables
  52.         bool m_training;
  53.         float m_trainingTime, m_maxTrainingTime;
  54.         int m_trainingUnit;
  55.         EFFECT_TRAINING *m_pTrainingEffect;
  56. };
  57.  
  58. #endif